package controller.comparator;

import java.util.Comparator;
import java.util.Date;

import entity.Course;

public class CourseComparatorByExamStart implements Comparator<Course> {

	@Override
	public int compare(Course course, Course anotherCourse) {

		/*
		 * Compare examStart in ascending order
		 */
		Date examStart = course.getExamStart();
		Date anotherExamStart = anotherCourse.getExamStart();
		if (examStart.before(anotherExamStart)) {
			return -1;
		} else if (examStart.after(anotherExamStart)) {
			return 1;
		}

		return 0;
	}

}
